﻿@using Core.Contract.DataContract
@using www.Controllers
@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<input type="hidden" id="hdncul" value="@Session["Culture"]" />
<input type="hidden" id="hdnpagePhoto" />

<script type="text/javascript">
    $().ready(function () {
        $("#hdnpagePhoto").val(1);
        //alert($("#hdncul").val());
    });

    function LoadDataRecord() {
        $('div#loading').html('<p><img src="/Images/Design/loading.gif" style="width:100%; height:25px;position:relative;"></p>');

        $.ajax({
            type: 'Get',
            url: '@Url.Action("GetPhotoDataContract", "Home")',
            data: { page: parseInt($("#hdnpagePhoto").val()) + 1 },
            async: false,
            dataType: "html",
            success: function (data) {
                if (data != '') {
                    $("#imgcommic").append(data);
                    $("#hdnpagePhoto").val(parseInt($("#hdnpagePhoto").val()) + 1);
                }
            },
            error: function (xhr, ajaxOptions, thrownError) {
                //alert(xhr.status);
                //alert(thrownError);

            }
        });
        $('div#loading').empty();
    }

    $(window).scroll(function () {
        if ($(window).scrollTop() == $(document).height() - $(window).height()) {

            LoadDataRecord();
        }
    });
</script>

<div class="content">
    <div class="default-left">
        <div id="imgcommic">
            @Html.Partial("ImgComicPartial")
        </div>
        <div id="loading"></div>
    </div>
    <div class="default-right">
            <div id="readstory">

                @if (ViewBag.RelaxStoryDataContracts != null)
                {
                    foreach (var item in (List<RelaxStoryDataContract>)ViewBag.RelaxStoryDataContracts)
                    {
                    <div class="readfun">
                        <div class="imgredstory">
                            <a href="/Home/StoryDetail/@Session["Culture"]/@item.CategoryId/@item.Id/@item.Tag">
                                <img src="../@item.Image" alt="@item.Name"/>
                            </a>
                        </div>
                        <div class="deinfo">
                            <div class="row name">
                                <h3><a href="/Home/StoryDetail/@Session["Culture"]/@item.CategoryId/@item.Id/@item.Tag">@item.Name</a></h3>
                            </div>
                            <div class="content detail-content">
                                @if (item.Decription != null && HttpUtility.HtmlDecode(item.Decription).Length > 80)
                                {
                                    <h4>@Html.Raw(HttpUtility.HtmlDecode(item.Decription).Substring(0, 80)) ... </h4> 
                                    <a href="/Home/StoryDetail/@Session["Culture"]/@item.CategoryId/@item.Id/@item.Tag">@Utility.GetResource.GetResouceValue(Session["Culture"], "lblWatchDetail")...</a>
                                }
                                else
                                {
                                    <h4>@Html.Raw(HttpUtility.HtmlDecode(item.Decription))</h4> 
                                    <a href="/Home/StoryDetail/@Session["Culture"]/@item.CategoryId/@item.Id/@item.Tag">@Utility.GetResource.GetResouceValue(Session["Culture"], "lblWatchDetail")...</a>
                                }
                            </div>
                        </div>
                    </div>
                    }
                    <div class="watchmore">
                        <a href="/Home/Story/@Session["Culture"]">@Utility.GetResource.GetResouceValue(Session["Culture"], "lblWatchMore")...</a>
                    </div>
                }
            </div>
        <div id="space"></div>
    </div>
</div>

@*<div class="clear"></div>
<div id="imagesexy" class="content">
    @if (ViewBag.ImageSexy != null)
    {
        foreach (var item in (List<RelaxStoryDataContract>)ViewBag.ImageSexy)
        {
        <div class="imageIcon">
            <div class="imagetitle">@item.Name</div>
            <img src="../@item.Image" alt="@item.Name"/>
        </div>
        }
        <div class="watchmore">
            <a href="/">Xem thêm...</a>
        </div>
    }
</div>*@
